<template>
  <div class="footer">
    <ul class="foot-left">
      <li><img src="@/assets/images/detail/kf.png" alt="" /><span>客服</span></li>
      <li @click="$router.push('/cart')"><img src="@/assets/images/detail/cart.png" alt="" /><span>购物车</span></li>
      <li v-if="isShow"><img src="@/assets/images/detail/sc4.png" alt="">收藏</li>
      <li v-if="!isShow"><img src="@/assets/images/detail/sc5.png" alt="" /><span>已收藏</span></li>
    </ul>
    <div class="foot-right">
      <div class="cart" @click="addToCartFn">加入购物车</div>
      <div class="mai" @click="buyGoods">购买</div>
    </div>
  </div>
</template>

<script>
import { AddCartApi } from "@/request/api";
export default {
  data() {
    return {
      isShow:true,
      id:null,
      selectCount:null,
      goodsinfo:null,
    };
  },
  created(){
     AddCartApi({
        product_id: this.product_id,
        price:this.price,
        product_amount:this.product_amount
      }).then((res) => {
        console.log(res);
        // if (res.data.code === 0) {
        //   let obj = { content: "已成功添加到购物车", icon: "success" };
        //   this.$store.dispatch("AsyncToast", obj);
        // } else {
        //   let obj = { content: res.data.message, icon: "info" };
        //   this.$store.dispatch("AsyncToast", obj);
        // }
      });
  },
  methods:{
    buyGoods(){
       this.$store.commit("changeBuyShow", true);
       
    }
  },
  addToCartFn(){
     var goods={
      id :this.id,
      count:this.selectCount,
      price:this.goodsinfo
     }
  }
};
</script>
 
<style lang = "less" scoped>
.footer {
  display: flex;
  justify-content: start;
  align-items: center;
  width: 100%;
  font-size: 16px;
  .foot-left{
    width: 45%;
    display: flex;
    justify-content: start;
    background: #fff;
    li {
      height: 49px;
      width: 33.3%;
      /* border: 1px solid #000; */
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
       img{
      width: 6vw;
      height:6vw ;
    }
    }
  }
  .foot-right {
    width: 55%;
    display: flex;
   
    .cart {
      width: 50%;
      background: #ffE817;
        height: 49px;
        /* border: 1px solid #000; */
        text-align: center;
        line-height: 49px;
       
    }
    .mai{
        height: 49px;
      width: 50%;  
       background: #Eb4868;
       color: #fff;
       /* border: 1px solid #000; */
      text-align: center;
        line-height: 49px;
    }
  }
}
</style>